UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6plGkvLFos4vWcmFu4kLxR6hO1s08SXVIXO+NlDa0/Q=' 
WHERE 
  key_id = '7d37349088d514f1ae8f551bb207b09969737323d2473346021bed6e221b2442' 
  AND (
    token = '6plGkvLFos4vWcmFu4kLxR6hO1s08SXVIXO+NlDa0/Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046