UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B6nMKiBxVfOSdtexZa1js3C9QBltp2wQNHMd1WYycKw=' 
WHERE 
  key_id = '543de50f5dc2d8097bb27ed14723428d104d0f8925e52ffcd5c6ab7ed10d1b9b' 
  AND (
    token = 'B6nMKiBxVfOSdtexZa1js3C9QBltp2wQNHMd1WYycKw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00059