UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'I9zvXDkHoVQXmyDYhEVMKqqYdQ0XNjSQQGAWR5Rcocw=' 
WHERE 
  key_id = '3c494c8fb2cc882f16e1716cd28f847523b2b4f50d22dcc6979a7ddb97977f1f' 
  AND (
    token = 'I9zvXDkHoVQXmyDYhEVMKqqYdQ0XNjSQQGAWR5Rcocw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044