UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Uo9dYpCW+qiRDo9xWj/0OAq2F6yrHOoUf76zf5wghXI=' 
WHERE 
  key_id = '984edc1f96f45e7bdb143b9526f3d5862210cf546226b7e5beeae61118cd1976' 
  AND (
    token = 'Uo9dYpCW+qiRDo9xWj/0OAq2F6yrHOoUf76zf5wghXI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027