UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xdtHc4N7korGacgEet6QKbE4hLBl2w0mYADP+QO94gk=' 
WHERE 
  key_id = '41277d8b51475446948fac88d0e2fed4018239b61a265a9b31b47942d8e07a84' 
  AND (
    token = 'xdtHc4N7korGacgEet6QKbE4hLBl2w0mYADP+QO94gk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024