UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nXmOGTLj/uPtfCS+2H+g+wrTiol/o43HxIrB019/f7M=' 
WHERE 
  key_id = '2a5bf3b5efd277dfafc769c4037cc536ce40e5651a936af7ac8dee58d5cfe2dd' 
  AND (
    token = 'nXmOGTLj/uPtfCS+2H+g+wrTiol/o43HxIrB019/f7M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021