UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '61lbAaqLCpqkw72OI9hGh88diN4Bw7QESOr3ujaAOBA=' 
WHERE 
  key_id = '9f89fac9c4159390b882f632a6ee0679561617ade0349e8d89931dfb12a9feae' 
  AND (
    token = '61lbAaqLCpqkw72OI9hGh88diN4Bw7QESOr3ujaAOBA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00067