UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NhyRogfsDPPa/K14AuERbp2h6izcNKZVvHZz69gBluU=' 
WHERE 
  key_id = '7bbb7738b235a645ef8854e945405b7b95647478a3ba0f4ae59776b6ef2d1585' 
  AND (
    token = 'NhyRogfsDPPa/K14AuERbp2h6izcNKZVvHZz69gBluU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00059