UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '36bCe/QzGCbG7O8+NgH868AMlEDJkggYPx+wLbMVukk=' 
WHERE 
  key_id = 'ddd3c0ed77af93a52256d7c9f5bb015fe201baeecb5b7ac3cec2d83207a33906' 
  AND (
    token = '36bCe/QzGCbG7O8+NgH868AMlEDJkggYPx+wLbMVukk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026