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

Query time 0.00023