UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bK5Smvsf6W+gE7yNib7bvUGHJ6n7IIElfK/SM3Oy+E4=' 
WHERE 
  key_id = '52b98da930e9806a47e1feb533a84bced1809d0254f790a42d407358daa93e07' 
  AND (
    token = 'bK5Smvsf6W+gE7yNib7bvUGHJ6n7IIElfK/SM3Oy+E4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031