UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gJrFPAUyv5oN/Rjl3sERT29a/ECFVkFs4bK67v7mU9M=' 
WHERE 
  key_id = 'c878477ae4f81716337d9351b9eab3b78191f85b49e0ecf36526ff4cb870329f' 
  AND (
    token = 'gJrFPAUyv5oN/Rjl3sERT29a/ECFVkFs4bK67v7mU9M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040