UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+mzXdLQY0+5dMmOtULLN1/9bZwUjUh0TCYJycpX3d9c=' 
WHERE 
  key_id = '09123cd9406ae37101ef62d9755860732f8349557db4b1d93284e4bf2d057006' 
  AND (
    token = '+mzXdLQY0+5dMmOtULLN1/9bZwUjUh0TCYJycpX3d9c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043