UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aCbZf2IIaL2CHGMANmFuaRL77ZszSSsGOrrsdzRCmlk=' 
WHERE 
  key_id = '3f1d5d68bcd7617317ebd318a5a14a0fcb073c9135348938dff5cb49efe90af7' 
  AND (
    token = 'aCbZf2IIaL2CHGMANmFuaRL77ZszSSsGOrrsdzRCmlk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050