UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yBQEb8AQTf8yck3NWmczke87ptpVs5X3pZ4/b6SU/5Q=' 
WHERE 
  key_id = '7cae5e8e72eb35ec5d589625635d9731491f087256c05e350390d500dfe8c1d8' 
  AND (
    token = 'yBQEb8AQTf8yck3NWmczke87ptpVs5X3pZ4/b6SU/5Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038