UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UqLO+7L4kVgshetcDSTqvVpDiQ+XtHvs7uhI1hfEEhM=' 
WHERE 
  key_id = '0facb3970b182a7a22deb78b5459ce4b5609ee2f374f7e02e65d86807af6256a' 
  AND (
    token = 'UqLO+7L4kVgshetcDSTqvVpDiQ+XtHvs7uhI1hfEEhM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039