UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'maRSwS0ZlFL+11gCiQU7dIZa1mxxUnPZBPmERgZZ+Yc=' 
WHERE 
  key_id = '313a6951cc51e1890254f25f4a949aee2d9e98f78905795865d87d5fc50b6996' 
  AND (
    token = 'maRSwS0ZlFL+11gCiQU7dIZa1mxxUnPZBPmERgZZ+Yc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017