UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q+DGW+d+ycKw76kbT9fORDGmkQbleAxKwDn5Iu9YlOA=' 
WHERE 
  key_id = '913bfd50be89b58b9d03e522b7a9244d6b99061e74ff3433ed77b993a402a993' 
  AND (
    token = 'q+DGW+d+ycKw76kbT9fORDGmkQbleAxKwDn5Iu9YlOA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030