UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ryLviar2iIyqmorBWFHKH5ykob0+Ek+xoN9lI6fhLW4=' 
WHERE 
  key_id = 'cdcc804c9a867cb89cbbec0e3925ba59827cd24feeaaff2ba4f81935242857b1' 
  AND (
    token = 'ryLviar2iIyqmorBWFHKH5ykob0+Ek+xoN9lI6fhLW4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035