UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PrL2WU6dlv+lI8LP54WABJJHBcgqdqz1zcEli7VzFJ4=' 
WHERE 
  key_id = '18f795d6f827d5dbddafe1833177a4d8980fbb5b93883422291e75a6341a1b06' 
  AND (
    token = 'PrL2WU6dlv+lI8LP54WABJJHBcgqdqz1zcEli7VzFJ4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043