UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Bj1/0X3awdWtiJa+hTLk2ayBesX3gBW5ntoO09ke+Jo=' 
WHERE 
  key_id = 'c2dcdd00e6d605ed299ce8f8b7717c249932638649dd7f4d1d4b9c50243dd560' 
  AND (
    token = 'Bj1/0X3awdWtiJa+hTLk2ayBesX3gBW5ntoO09ke+Jo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029