UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MScvcEbZYqiZNl/5WRWqueaoI/tM4MoRlyhn1tYC0+Y=' 
WHERE 
  key_id = '423d55e4b2c32e9c2990d60e18345850edb8f76a804e46774ee7fcbfbe2d9587' 
  AND (
    token = 'MScvcEbZYqiZNl/5WRWqueaoI/tM4MoRlyhn1tYC0+Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024