UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aVNpiFo1zFbDo/Bw4Pzb/SdPFQQfBFiv7IypiMmLtB8=' 
WHERE 
  key_id = 'f7ef0c51057549d8b59e0495ac1f6885cde2e2ac091baffd876e5f104100ca21' 
  AND (
    token = 'aVNpiFo1zFbDo/Bw4Pzb/SdPFQQfBFiv7IypiMmLtB8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040