UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yEHY1dLqVtH1WLhiTz/COrX+ymE9QmRtVgI3DnzYtFM=' 
WHERE 
  key_id = 'b2f58e2040daf69b69a194de69923ee3517bb71759dfbfb5d7233191a8f7725c' 
  AND (
    token = 'yEHY1dLqVtH1WLhiTz/COrX+ymE9QmRtVgI3DnzYtFM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027