UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2rR1RkdAkubBatUvaWUQcB6Gp32Z/m8IhACnQJ3l8CQ=' 
WHERE 
  key_id = '8584b48ec6836b34c2cf7476555495366a593fb78f9da7c189295c42685a06a6' 
  AND (
    token = '2rR1RkdAkubBatUvaWUQcB6Gp32Z/m8IhACnQJ3l8CQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046