UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q6hz0kwNrS28/3jPmgJ00khfq0S/EFBy22LLtpU1ULQ=' 
WHERE 
  key_id = 'b7724e93e055d9bd7bd8eb58c0537e156246631f869962a00539d396118de388' 
  AND (
    token = 'q6hz0kwNrS28/3jPmgJ00khfq0S/EFBy22LLtpU1ULQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034