UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YDDcStKJ+yBNv6M70152mo3qGfs8wsNuw83bxivrVto=' 
WHERE 
  key_id = '3193e684ed03da2cdd6b958ce3bea55e7c8ad10e9128c7742ab0db4c20398e89' 
  AND (
    token = 'YDDcStKJ+yBNv6M70152mo3qGfs8wsNuw83bxivrVto=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023