UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VBBi4jAjzuPJyFRBeo7cv5K9VH+jlt0uH+teYuUSCwM=' 
WHERE 
  key_id = '0aaad0f6f2707855ac199732c4956d6d6d4753205509795474d874c705581ded' 
  AND (
    token = 'VBBi4jAjzuPJyFRBeo7cv5K9VH+jlt0uH+teYuUSCwM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033