UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+Iz4EFpcxNDfbwDMAq+xOdEBhFEtTaeo40pHjclmKYw=' 
WHERE 
  key_id = '2fb772c70767ca55584ecbfe06a25a33b0a74a1c45b82bd90cee7d913a730f91' 
  AND (
    token = '+Iz4EFpcxNDfbwDMAq+xOdEBhFEtTaeo40pHjclmKYw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00059