UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sUNoHVmBzoX2HwjLoKUEXUDftijxIkfRwmSAYisbxkE=' 
WHERE 
  key_id = 'ddb0b543cd91ad57b490a31688ccaa14b967344bfd1927b020c12cd0822555b1' 
  AND (
    token = 'sUNoHVmBzoX2HwjLoKUEXUDftijxIkfRwmSAYisbxkE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021