UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IICNpK4a/SUC7ot19OLE1MR/s0QHbM5sMer9MDjafUo=' 
WHERE 
  key_id = '5ce63b2e3ab66aaf69482569560c1e01f0c0bfc9d582708403767f19aa222301' 
  AND (
    token = 'IICNpK4a/SUC7ot19OLE1MR/s0QHbM5sMer9MDjafUo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026