UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oKzWejQesfH6falBrSpHx700z8pDw1PuyEKJPoYEvps=' 
WHERE 
  key_id = '65d19277d78ed19f282f1d0046dad5b9d4e730031497774220879a9bcbfb4b11' 
  AND (
    token = 'oKzWejQesfH6falBrSpHx700z8pDw1PuyEKJPoYEvps=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024