UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RhbgL0cKJAzbKQLzw92NMPVdu5mDncvocxUh7C8dyGw=' 
WHERE 
  key_id = '38376f8a88fb215bc396a6c1f8b30b948b0d045abebfe7d6d24b9303fb25d517' 
  AND (
    token = 'RhbgL0cKJAzbKQLzw92NMPVdu5mDncvocxUh7C8dyGw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027