UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'A0iZN6eqLAR5vl0pZb22SzJjhaRJn3mgwEGLr7W6Rp0=' 
WHERE 
  key_id = 'ca6548f00e4989fb2b9341e3666aa92a4b9d92b498aa61d312671572f890ba14' 
  AND (
    token = 'A0iZN6eqLAR5vl0pZb22SzJjhaRJn3mgwEGLr7W6Rp0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022