UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AzlM/b0zm9x1v+LQR+28UrOU7BScgZBUypItJd/4KVc=' 
WHERE 
  key_id = '77f8748a707e38c320896e0aac694f61196bede2d96fccbefc39febd439731df' 
  AND (
    token = 'AzlM/b0zm9x1v+LQR+28UrOU7BScgZBUypItJd/4KVc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033