UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'czbenry2HDzuyBWx/J+1xCk3OeJPbZbvDFbkOmXuUsw=' 
WHERE 
  key_id = '1a1072f9e1a2457c40130ecee650c1c75ccc65837b38388d6e7d5ccba13bc4d2' 
  AND (
    token = 'czbenry2HDzuyBWx/J+1xCk3OeJPbZbvDFbkOmXuUsw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019