UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oh9vo0Xr6APgwxJjLHT+p1t9gVamQU3xQXD6IMZRF+E=' 
WHERE 
  key_id = '754faaebef2dc5bf121238dbfb666f0d756127ec81e84363b4db12c4d802f808' 
  AND (
    token = 'oh9vo0Xr6APgwxJjLHT+p1t9gVamQU3xQXD6IMZRF+E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043