UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hmzZyQM134WFV+ivi0g6obKVy42gx5HjV4wbvBvYAOY=' 
WHERE 
  key_id = '409061543d8b89e85100d8d3a857c8ee43a0b1c6775777a5aca1bf764eba2143' 
  AND (
    token = 'hmzZyQM134WFV+ivi0g6obKVy42gx5HjV4wbvBvYAOY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025