UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RcSPCqpVlOc9WA5pqlVaeYVzlmeuuCOMzx+rm/pDjR0=' 
WHERE 
  key_id = '752fae9139d745fb193ce836e2f43a25dac81890f8f927328a8e0b8364925168' 
  AND (
    token = 'RcSPCqpVlOc9WA5pqlVaeYVzlmeuuCOMzx+rm/pDjR0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00093