UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HGj1a8iGGk2/DlMWziVCWtC5PDa7Yz+UMg88zLcpPMg=' 
WHERE 
  key_id = 'ef6ed9a57e295f4a868301b1d70583986f92166c860522bc147d3398c721a154' 
  AND (
    token = 'HGj1a8iGGk2/DlMWziVCWtC5PDa7Yz+UMg88zLcpPMg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00056